//
// Created by Asus on 2025/6/2.
//

#include <iostream>
#include <queue>
#include <string>
using namespace std;

class Person
{
public:
    Person(string name, int age)
    {
        this->m_Name = name;
        this->m_Age = age;
    }
    string m_Name;
    int m_Age;
};

void demo01() {
    queue<Person> q;
    q.push(Person("John", 18));
    q.push(Person("John", 19));
    q.push(Person("John", 20));
    q.push(Person("John", 21));

    while (!q.empty()) {
        //输出队头元素
        cout << "队头元素-- 姓名： " << q.front().m_Name
              << " 年龄： "<< q.front().m_Age << endl;
        cout << "队尾元素-- 姓名： " << q.back().m_Name
              << " 年龄： " << q.back().m_Age << endl;
        cout << endl;
        //弹出队头元素
        q.pop();
    }
}

int main(int argc, char *argv[]) {
    demo01();
    return 0;
}
